From 48a5d757f491110366d16b5f4ce56671b2194bfa Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Fri, 20 Mar 2015 19:30:08 -0700 Subject: [PATCH] Don't fail `cargo run` with bins + examples If no filter is supplied, then only consider binaries as candidates, not examples as well. --- src/cargo/ops/cargo_run.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/cargo/ops/cargo_run.rs b/src/cargo/ops/cargo_run.rs index 63183c629..787c1e374 100644 --- a/src/cargo/ops/cargo_run.rs +++ b/src/cargo/ops/cargo_run.rs @@ -18,7 +18,10 @@ pub fn run(manifest_path: &Path, // will verify that we're buliding at least one binary, so we don't check // for that form of existence here. let mut bins = root.manifest().targets().iter().filter(|a| { - options.filter.matches(a) && !a.is_lib() && !a.is_custom_build() + !a.is_lib() && !a.is_custom_build() && match options.filter { + CompileFilter::Everything => a.is_bin(), + CompileFilter::Only { .. } => options.filter.matches(a), + } }); let _ = bins.next(); if bins.next().is_some() { -- 2.30.2